<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>欢迎登录后台管理系统</title>
<link href="__STATIC__/Admin/css/base.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/Admin/css/right.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/css/page.css" rel="stylesheet" type="text/css">
<script src="__STATIC__/js/jquery-2.1.1.min.js"></script>
<script>
$(document).ready(function(){
   $(function(){
      $('.rightinfo tbody tr:odd').css("backgroundColor","#f5f8fa");
   });
   $(".imgact1").click(function(){
	   var id=$(this).parent().find("input[name='id']").val();
	   var img=($(this).attr("src")=='__STATIC__/Admin/image/no.gif') ? "__STATIC__/Admin/image/yes.gif":"__STATIC__/Admin/image/no.gif";
	   $(this).attr("src",img);
	   $.post("{:url('ajaxhbcode')}",{id:id},function(data){});
   });
});
function del(){ if(confirm("确定要删除吗？")) {   return true;  }  else  {  return false;  } }
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li><a href="{:url('Index/center')}">首页</a></li>
    <li><a>散户佣金</a></li>
  </ul>
</div>
<div class="rightinfo">
    <table class="tablelist">
    <thead>
      <tr>
        <th>佣金等级</th>
        <th>佣金比例</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
    {volist name="list" id="vo"}
		<tr height="45" align="center">
        <td>{$vo['type']}级</td>
        <td>{$vo['baifenbi']}%</td>
        <td>
          <img src="__STATIC__/Admin/image/leftico03.png" width="14">
          <a href="#" val="{$vo['id']}" class="edit">编辑</a>&nbsp;
        </td>
      </tr>
    {/volist}
    </tbody>
  </table>
</div>
</body>
<script>
    $(function () {
        //删除默认代理佣金
        $(".del").click(function () {
            var id = $(this).attr('val');
            if(confirm('确定删除？')) {
                $.ajax({
                    url:"{:url('comdel')}",
                    data:{id:id},
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.flag == 0) {
                            window.location.reload();
                        }else {
                            alert(data.msg);
                        }
                    }
                });
            }
        });

        //修改默认代理佣金
        $(".edit").click(function () {
            var id = $(this).attr('val');
            var bl = prompt("请输入佣金比例",0);
            if(!validateInt(bl) || bl <= 0) {
                alert("请输入大于0的整数");
                return false;
            }
            $.ajax({
                url:"{:url('Daili/comPrecent')}",
                data:{id:id,bl:bl},
                type:'POST',
                dataType:'json',
                success:function (data) {
                    if(data.flag == 0) {
                        window.location.reload();
                    }else {
                        alert(data.msg);
                    }
                }
            });
        });

        function validateInt(val){
            var reg = /^\+?[0-9][0-9]*$/;
            return reg.test(val)
        }
    })
</script>
</html>